<template>
  <div class="modal" @click="handleOverlayClick">
    <div class="modal-overlay"></div>
    <div class="modal-content battle-power-modal">
      <div class="modal-header">
        <h3><i class="fas fa-info-circle"></i> 战斗力说明</h3>
        <button class="modal-close" @click="$emit('close')">
          <i class="fas fa-times"></i>
        </button>
      </div>
      <div class="modal-body">
        <div class="power-explanation">
          <div class="explanation-content">
            <div class="explanation-item">
              <div class="explanation-title">
                <i class="fas fa-question-circle"></i>
                什么是战斗力？
              </div>
              <div class="explanation-text">
                战斗力代表您在平台上的综合实力，通过创建内容、完成任务、保持活跃等方式获得。
              </div>
            </div>
            <div class="explanation-item">
              <div class="explanation-title">
                <i class="fas fa-calculator"></i>
                如何计算战斗力？
              </div>
              <div class="calculation-details">
                <div class="calc-item">
                  <span class="calc-label">创建笔记</span>
                  <span class="calc-value">+20 战斗力/个</span>
                </div>
                <div class="calc-item">
                  <span class="calc-label">创建视频课程</span>
                  <span class="calc-value">+30 战斗力/个</span>
                </div>
                <div class="calc-item">
                  <span class="calc-label">添加章节内容</span>
                  <span class="calc-value">+10 战斗力/个</span>
                </div>
                <div class="calc-item">
                  <span class="calc-label">优质内容(>500字)</span>
                  <span class="calc-value">+15 战斗力/个</span>
                </div>
                <div class="calc-item">
                  <span class="calc-label">完成任务</span>
                  <span class="calc-value">+5 战斗力/个</span>
                </div>
                <div class="calc-item">
                  <span class="calc-label">近期活跃</span>
                  <span class="calc-value">+8 战斗力/次</span>
                </div>
                <div class="calc-item">
                  <span class="calc-label">优质视频(≥10分钟)</span>
                  <span class="calc-value">+20 战斗力/个</span>
                </div>
                <div class="calc-item">
                  <span class="calc-label">保持一致性</span>
                  <span class="calc-value">+3~25 战斗力</span>
                </div>
              </div>
            </div>
            <div class="explanation-item">
              <div class="explanation-title">
                <i class="fas fa-rocket"></i>
                快速提升方法
              </div>
              <div class="quick-tips">
                <div class="quick-tip">
                  <i class="fas fa-plus-circle"></i>
                  <span>创建新的笔记课程 (+20)</span>
                </div>
                <div class="quick-tip">
                  <i class="fas fa-video"></i>
                  <span>制作视频教程 (+30)</span>
                </div>
                <div class="quick-tip">
                  <i class="fas fa-edit"></i>
                  <span>丰富章节内容 (+3~15)</span>
                </div>
                <div class="quick-tip">
                  <i class="fas fa-check-circle"></i>
                  <span>完成待办任务 (+5)</span>
                </div>
                <div class="quick-tip">
                  <i class="fas fa-calendar-check"></i>
                  <span>保持定期更新 (+8~25)</span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'BattlePowerModal',
  emits: ['close'],
  methods: {
    handleOverlayClick(e) {
      if (e.target.classList.contains('modal') || e.target.classList.contains('modal-overlay')) {
        this.$emit('close')
      }
    }
  }
}
</script>

<style scoped>
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.battle-power-modal {
  max-width: 800px;
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #64748b;
}

.modal-close:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.modal-body {
  padding: 1.5rem;
}

.explanation-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.explanation-item {
  background: #f8fafc;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.explanation-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 1rem;
}

.explanation-title i {
  color: #3b82f6;
}

.explanation-text {
  font-size: 12px;
  color: #64748b;
  line-height: 1.6;
}

.calculation-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.calc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: white;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.calc-label {
  font-size: 12px;
  color: #64748b;
}

.calc-value {
  font-size: 11px;
  font-weight: 600;
  color: #059669;
  background: #ecfdf5;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
}

.quick-tips {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quick-tip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: white;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  color: #64748b;
}

.quick-tip i {
  color: #3b82f6;
  width: 16px;
  text-align: center;
}

@media (max-width: 768px) {
  .battle-power-modal {
    max-width: 90vw;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .explanation-content {
    gap: 1.5rem;
  }
  
  .explanation-item {
    padding: 1rem;
  }
  
  .calc-item, .quick-tip {
    padding: 0.5rem;
  }
  
  .calc-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}
</style>